<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit user</title>
</head>
<body>

<a href="./LogoutController">Log out</a> <br/>
<a href="./HomeController">Home</a> <br/>

<form action="./EditUserController" method="post" accept-charset="UTF-8"
		enctype="multipart/form-data">
	<table>
		<tr>
			<td>User information:</td>
		</tr>
		<tr>
			<td>
				<img alt="Greška, nema slike." src="${ user.profileImage.location }">
			</td>
		</tr>
		<tr>
			<td><label for="emailAddress">Email</label></td>
			<td><input type="email" name="emailAddress" value="${ user.emailAddress }"></td>
		</tr>
		<tr>
			<td><label for="password">Password</label></td>
			<td><input name="password" type="password"></td>
		</tr>
		<tr>
			<td><label for="profileImage">Choose profile image</label></td>
			<td><input name="profileImage" type="file" accept="image/jpeg,image/bmp,image/png"/></td>
		</tr>
		<tr>
			<td><label for="firstname">First name</label></td>
			<td><input type="text" name="firstname" value="${ user.firstname }"></td>
		</tr>
		<tr>
			<td><label for="lastname">Last name</label></td>
			<td><input type="text" name="lastname" value="${ user.lastname }"></td>
		</tr>
		<tr>
			<td>
				<c:out value="Gender: ${ user.gender }"></c:out>
			</td>
		</tr>
		<tr>
			<td><label for="gender">Change gender</label></td>
			<td><select name="gender">
				<option value="MALE" selected="selected">Male</option>
				<option value="FEMALE">Female</option>
			</select></td>
		</tr>
		<tr>
			<td>
				Date of birth: ${ user.dateOfBirth }
			</td>
		</tr>
		<tr>
			<td><label for="dateOfBirth">Change date of birth</label></td>
			<td><input type="date" name="dateOfBirth"></td>
		</tr>
		<tr>
			<td><label for="emailNotifications">Email notifications</label></td>
			<td>
				<c:if test="${ user.emailNotifications == true }">
					<input type="checkbox" name="emailNotifications" checked="checked">
				</c:if>
				<c:if test="${ user.emailNotifications == false }">
					<input type="checkbox" name="emailNotifications">
				</c:if>
			</td>
		</tr>
		<tr>
			<td><input type="submit" value="Update"></td>
			<td>
				<a href="./home.jsp"><input type="button" value="Cancel"></a>
			</td>
		</tr>
	</table>
</form>

</body>
</html>